
{extend name="AdminEx/index" /}

{block name="mycss"}
    <!-- 富文本编辑 -->
    <link href="/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="/umeditor/third-party/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/umeditor/umeditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/umeditor/umeditor.min.js"></script>
    <script type="text/javascript" src="/umeditor/lang/zh-cn/zh-cn.js"></script>
    <style type="text/css">
        .edui-modal {left: 32%;}
    </style>
{/block}
{block name="main"}
        <!-- page heading start-->
        <div class="page-heading">
            <h3>
                {$title}
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">文章管理</a>
                </li>
                <li class="active"> 新增文章 </li>
            </ul>
        </div>
        <!-- page heading end-->

        <!--body wrapper start-->
        <div class="wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <section class="panel">
                        <header class="panel-heading">
                           编辑文章
                        </header>
                        <div class="panel-body">
                            <form  action="{:url('admin/Article/update',['id'=>$data.id])}" enctype="multipart/form-data" method="post" role="form" class="form-horizontal adminex-form">
                                <input type="hidden" name="_method" value="put">
                                <div class="form-group has-success">
                                    <label class="col-lg-2 control-label">书名</label>
                                    <div class="col-lg-10">
                                        <input name="dname" value="{$data.dname}" type="text" placeholder="" id="f-name" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group has-success">
                                    <label class="col-lg-2 control-label">标题</label>
                                    <div class="col-lg-10">
                                        <input name="name" value="{$data.name}" type="text" placeholder="" id="f-name" class="form-control">
                                    </div>
                                </div>
                                <div class="form-group has-success">
                                    <!--style给定宽度可以影响编辑器的最终宽度-->
                                    <label class="col-lg-2 control-label">内容</label>
                                    <div class="col-lg-10">
                                        <div id="content" style="display:none">{$data.content}</div>
                                        <script type="text/plain" id="myEditor" style="width:800px;height:240px;">
                                        </script>
                                    </div>
                                    
                                </div>

                                <div class="form-group">
                                    <div class="col-lg-offset-2 col-lg-10">
                                        <button class="btn btn-primary" type="submit">Submit</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </section>
                </div>
            </div>

{/block}

{block name="myjs"}
<script type="text/javascript">
    //实例化编辑器
    var um = UM.getEditor('myEditor');
    // 将内容填入编辑器
    var str = $('#content').html();
    $('#myEditor').html(str);
    $('#content').remove();
</script>
{/block}